package com.sun.controllers.users;
import cn.dev33.satoken.util.SaResult;
import com.sun.dto.BaseSearchDto;
import com.sun.dto.users.RoleDto;
import com.sun.impls.BaseService;
import com.sun.services.users.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * 角色控制器，处理角色相关的HTTP请求
 */
@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;
    @PostMapping("/createRole")
    public SaResult createRole(@RequestBody RoleDto roleDto) {
        return roleService.createRole(roleDto);
    }
    @PostMapping("/updateRole")
    public SaResult updateRole(@RequestBody RoleDto roleDto) {
        return roleService.updateRole(roleDto);
    }
    @PostMapping("/deleteRole")
    public SaResult deleteRole(@RequestBody List<Long> ids) {
        return roleService.deleteRole(ids);
    }
    @GetMapping("/getRoleList")
    public SaResult getRoleList(BaseSearchDto search) {
        return SaResult.data(roleService.getRoleList(search));
    }
}
